#pragma once

#ifndef __3DVIEWERTEXTUREMANAGER_H__
#define __3DVIEWERTEXTUREMANAGER_H__

#include <list>
#include "FreeImage.h"


class CTexture
{
//attributes
public:
	unsigned int		 m_OpenglId;
	CString				 m_URI;
	bool				 m_changed;
	bool				 m_loadedOGL;

private:
	FIBITMAP *m_image;

public:
	CTexture(void) {};
	~CTexture(void) {};

	void OpenTextureData(int *width, int *height, int *format, BYTE **data);
	void CloseTextureData();
};


//////////////////////////////////////////////////////////////////////////////////////
// Texture manager
class CTextureManager
{
public:
    bool m_updateOGL;
	std::list<CTexture*> m_textures;

public:
	CTextureManager(void);
	~CTextureManager(void);

private:
	CTexture* FindTexture(CString URI);

public:
	CTexture* AddTexture(CString URI);
	bool	  DelTexture(CTexture *texture);
	void	  ModTexture(CTexture* texture, CString URI);

	unsigned int GetTextureId(CString URI);
};

extern CTextureManager  gTextureManager;

#endif